package com.shuangk.majingze.coolpapa.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.MainThread;

import com.shuangk.majingze.coolpapa.MainActivity;

import java.util.Map;
import java.util.Set;


public class Router {

    public static Intent buildIntent(Context context, Class clazz) {
        return buildIntent(context, clazz, null);
    }

    public static Intent buildIntent(Context context, Class clazz, Map<String, String> params) {
        Intent intent = new Intent();
        if (params != null) {
            Set<String> set = params.keySet();
            for (String key : set) {
                intent.putExtra(key, params.get(key));
            }
        }
        intent.setClass(context, clazz);
        return intent;
    }

    public static void toMainPager(Context context) {
        context.startActivity(buildIntent(context, MainActivity.class));
    }
}
